﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UI/UserUI/User.Master" AutoEventWireup="true"
    CodeBehind="PurchaseEntry.aspx.cs" Inherits="BoutiquePOS.UI.UserUI.PurchaseEntry" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../../Styles/UserUI/PurchaseEntryCss.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/UserUI/Common.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/AutoComplete/jquery-1.js" type="text/javascript"></script>
    <script src="../../Scripts/AutoComplete/jquery-ui.js" type="text/javascript"></script>
    <link href="../../Scripts/AutoComplete/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    
        $(function () {
            var availableTags = [ <%= SuggestionList %>];

            $("#<%=productNameTextBox.ClientID %>").autocomplete({
                source: availableTags
            });
        });        
        $(function () {
            var availableSupplier = [ <%= SupplierNameList %>];

             $("#<%=supplierNameTextBox.ClientID %>").autocomplete({
                 source:availableSupplier
             });
         });
        
        function validation() {
            if (document.getElementById('<%=paidAmountTextBox.ClientID %>').value == "") {
                document.getElementById('<%=messageLebel.ClientID %>').textContent = "Product name cannot be blank ";
                document.getElementById('<%=messageLebel.ClientID%>').style.color = "red";
                document.getElementById('<% =paidAmountTextBox.ClientID %>').focus();
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="contentHolderDiv">
        <fieldset>
            <div class="msgDiv">
                <asp:Label ID="messageLebel" runat="server"></asp:Label>
            </div>
            <fieldset>
                <legend>Purchase Entry</legend>
                <table width="100%">
                    <tr>
                        <td class="lebelField">
                            Purchase No
                        </td>
                        <td class="inputLebel">
                            <input type="text" id="purchaseNoTextBox" runat="server" class="textBoxDesign" />
                        </td>
                        <td class="lebelField">
                            Date
                        </td>
                        <td class="inputLebel">
                            <input type="text" id="purchaseDateTextBox" runat="server" tabindex="1" class="textBoxDesign" />
                        </td>
                        <td class="lebelField">
                            Supplier Name
                        </td>
                        <td class="inputLebel">
                            <input type="text" id="supplierNameTextBox" runat="server" tabindex="2" class="textBoxDesign" />
                        </td>
                    </tr>
                    <tr>
                        <td class="lebelField">
                            Chalan No
                        </td>
                        <td>
                            <input type="text" id="challanNoTextBox" runat="server" tabindex="4" class="textBoxDesign" />
                        </td>
                        <td class="lebelField">
                            PaymentMode
                        </td>
                        <td>
                            <select id="supplierModeDDList" runat="server" tabindex="3" class="textBoxDesign">
                                <option value="1">Cash</option>
                                <option value="2">Credit</option>
                            </select>
                        </td>
                        <td class="lebelField">
                            Product Category
                        </td>
                        <td>
                            <asp:DropDownList ID="productCategoryDDList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="productCategoryDDList_SelectedIndexChanged"
                                TabIndex="5" CssClass="textBoxDesign">
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
                <table width="100%">
                    <tr>
                        <td class="lebelField">
                          Net Amount
                        </td>
                        <td>
                            <input type="text" id="totalNetAmtTextBox" runat="server" class="textBoxDesign" />
                        </td>
                        <td class="lebelField">
                            Paid Amount
                        </td>
                        <td>
                            <asp:TextBox ID="paidAmountTextBox" runat="server" AutoPostBack="True" OnTextChanged="paidAmtTextBox_TextChanged"
                                CssClass="textBoxDesign"></asp:TextBox>
                        </td>
                        <td class="lebelField">
                            Due Amount
                        </td>
                        <td>
                            <input type="text" id="dueAmtTextBox" runat="server" class="textBoxDesign" />
                        </td>
                    </tr>
                </table>
            </fieldset>
            <fieldset>
                <legend>Product Entry</legend>
                <table class="productTB">
                    <tr>
                        <td>
                            Product Name
                        </td>
                        <td>
                            Qty
                        </td>
                        <td>
                            TP
                        </td>
                        <td>
                            Discount(%)
                        </td>
                        <td>
                            Total TP
                        </td>
                        <td>
                            Total Vat
                        </td>
                        <td>
                            Dis Amt
                        </td>
                        <td>
                            Net Amt
                        </td>
                        <td>
                            Free Qty
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" id="productNameTextBox" runat="server" class="SmalltextBoxProduct"
                                tabindex="6" />
                        </td>
                        <td>
                            <asp:TextBox ID="qtyTextBox" runat="server" OnTextChanged="qtyTextBox_TextChanged"
                                AutoPostBack="True" TabIndex="7" CssClass="SmalltextBox"></asp:TextBox>
                        </td>
                        <td>
                            <input type="text" id="tradePriceTextBox" runat="server" class="SmalltextBox" />
                        </td>
                        <td>
                            <asp:TextBox ID="discountPercentTextBox" runat="server" AutoPostBack="True" OnTextChanged="discountAmtTextBox_TextChanged"
                                TabIndex="8" CssClass="SmalltextBox"></asp:TextBox>
                        </td>
                        <td>
                            <input type="text" id="totalTPTextBox" runat="server" class="SmalltextBox" />
                        </td>
                        <td>
                            <input type="text" id="totalVatTextBox" runat="server" class="SmalltextBox" />
                        </td>
                        <td>
                            <input type="text" id="discountAmtTextBox" runat="server" class="SmalltextBox" />
                        </td>
                        <td>
                            <input type="text" id="netAmtTextBox" runat="server" class="SmalltextBox" />
                        </td>
                        <td>
                            <input type="text" id="freeQtyTextBox" runat="server" class="SmalltextBox" tabindex="9" />
                        </td>
                        <td>
                            <input id="addButton" type="button" value="Add" runat="server" class="addbutton"
                                onserverclick="AddtoGridView_Click" tabindex="10" />
                        </td>
                    </tr>
                </table>
            </fieldset>
            <fieldset>
                <div class="gridLoadDiv">
                    <asp:GridView ID="purchaseGridView" runat="server" AutoGenerateColumns="False" ForeColor="Black"
                        Style="margin-right: 1px" Width="100%" BackColor="White" BorderColor="#DEDFDE"
                        BorderStyle="None" BorderWidth="1px" GridLines="Vertical">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="Id" Visible="False">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("AProduct.ProductId") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("AProduct.ProductId") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Product Name">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("AProduct.ProductBrandName") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("AProduct.ProductBrandName") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="TradePrice" HeaderText="TP" />
                            <asp:BoundField DataField="PurchaseQty" HeaderText="Qty" />
                            <asp:BoundField DataField="PurchaseFreeQty" HeaderText="Free Qty" />
                            <asp:BoundField DataField="DiscountPer" HeaderText="Discount per" />
                            <asp:BoundField DataField="TotalTradePrice" HeaderText="Total TP"></asp:BoundField>
                            <asp:BoundField DataField="TotalVat" HeaderText="Total Vat" />
                            <asp:BoundField DataField="TotalDiscountAmount" HeaderText="Dis Amt" />
                            <asp:BoundField DataField="NetAmount" HeaderText="Net Amount" />
                            <asp:CommandField ShowEditButton="True" HeaderText="Edit"/>
                            <asp:CommandField ShowSelectButton="True" HeaderText="Select"/>
                        </Columns>
                        <FooterStyle BackColor="#CCCC99" />
                        <HeaderStyle BackColor="#6B696B" Font-Bold="False" ForeColor="White" />
                        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                        <RowStyle BackColor="#F7F7DE" />
                        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="False" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#FBFBF2" />
                        <SortedAscendingHeaderStyle BackColor="#848384" />
                        <SortedDescendingCellStyle BackColor="#EAEAD3" />
                        <SortedDescendingHeaderStyle BackColor="#575357" />
                    </asp:GridView>
                </div>
            </fieldset>
            <fieldset>
                <table class="afterGdvTB" width="100%">
                    <tr>
                        <td colspan="6">
                          
                            <div class="myAllButton">
                                <input id="saveButton" type="button" value="Save" runat="server" onserverclick="saveButton_Click"
                                    class="Belowbutton" tabindex="11" />&nbsp;
                                <input id="clearButton" type="button" value="Clear" runat="server" onserverclick="clearButton_Click"
                                    class="Belowbutton" />&nbsp;
                                <input id="closeButton" type="button" value="Close" runat="server" onserverclick="closeButton_Click"
                                    class="Belowbutton" />
                            </div>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </fieldset>
    </div>
</asp:Content>
<%--<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
</asp:Content>
--%>